import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:tapped/tapped.dart';

class IosBackButton extends StatelessWidget {
  final Color color;
  final IconData? icon;
  final double? size;
  final Function()? onPressed;
  const IosBackButton(
      {Key? key,
      this.color = Colors.white,
      this.icon = Icons.arrow_back_ios,
      this.size = 20, this.onPressed})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Tapped(
      child: Container(
        color: Colors.white.withOpacity(0),
        padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
        child: Icon(
          icon,
          color: color,
          size: size,
        ),
      ),
      onTap: () {
        if (onPressed == null) {
            Get.back();
        } else {
           onPressed!();
        }
       
      },
    );
  }
}
